package cn.mumzone.pos.model;

import android.support.annotation.NonNull;


import java.io.Serializable;
import java.util.List;

import cn.mumzone.basic.util.StringUtils;

/**
 * Created by lijiateng on 2018/8/24.
 */

public class GoodsEntity implements Serializable, Comparable, Cloneable {

    /**
     * supplierName :
     * brandName :
     * code : 1279473
     * supplierId :
     * unitName : 罐
     * primaryName :
     * goodsSpec : [{"name":"重量","value":["850克","900克"]},{"name":"段位","value":["二段","一段"]},{"name":"版本","value":["经典版","白金版"]}]
     * secondaryName :
     * price : 220
     * brandId :
     * name : 爱他美奶粉
     * threeClassify :
     * threeName :
     * goodsUnit :
     * id : 1
     * shopId : 1
     * secondaryClassify :
     * primaryClassify :
     * status : 0
     */

    private boolean isChecked;
    private String supplierName;
    private String brandName;
    private String code;
    private String supplierId;
    private String unitName;
    private String primaryName;
    private String secondaryName;
    private String price;
    private String storeId;
    private String sellerId;
    private String brandId;
    private String goodsName;
    private String threeClassify;
    private String threeName;
    private String goodsUnit;
    private String goodsId;
    private String shopId;
    private String secondaryClassify;
    private String primaryClassify;
    private String status;
    private String goodsCount;
    private String goodsCode;
    private String bargainPrice;
    private String registerCount;
    private String updateTime;
    private String goodsSkuId;
    private String memberPrice;
    private String discountAvg;
    private String goodsBatchNum;
    private String goodsQuantity;
    private String soldIntegral;
    private String integral;
    private String secondPrice;
    private String barCode;
    private String stockGoods;
    private int selectCount;
    private int presentNum;

    public String getStockGoods() {
        return stockGoods;
    }

    public void setStockGoods(String stockGoods) {
        this.stockGoods = stockGoods;
    }

    public String getBarCode() {
        return barCode;
    }

    public void setBarCode(String barCode) {
        this.barCode = barCode;
    }

    public String getIntegral() {
        return integral;
    }

    public void setIntegral(String integral) {
        this.integral = integral;
    }

    public int getPresentNum() {
        return presentNum;
    }

    public void setPresentNum(int presentNum) {
        if (presentNum < 0) {
            presentNum = 0;
        }
        this.presentNum = presentNum;
    }

    public String getSecondPrice() {
        return secondPrice;
    }

    public void setSecondPrice(String secondPrice) {
        this.secondPrice = secondPrice;
    }

    public String getSoldIntegral() {
        return soldIntegral;
    }

    public void setSoldIntegral(String soldIntegral) {
        this.soldIntegral = soldIntegral;
    }

    public int getSelectCount() {
        return selectCount;
    }

    public void setSelectCount(int selectCount) {
        this.selectCount = selectCount;
    }

    public String getGoodsBatchNum() {
        return goodsBatchNum;
    }

    public void setGoodsBatchNum(String goodsBatchNum) {
        this.goodsBatchNum = goodsBatchNum;
    }

    public String getGoodsQuantity() {
        return goodsQuantity;
    }

    public void setGoodsQuantity(String goodsQuantity) {
        this.goodsQuantity = goodsQuantity;
    }

    public String getGoodsCode() {
        return goodsCode;
    }

    public void setGoodsCode(String goodsCode) {
        this.goodsCode = goodsCode;
    }

    private List<GoodsSpecBean> goodsSpec;

    public String getDiscountAvg() {
        return discountAvg;
    }

    public void setDiscountAvg(String discountAvg) {
        this.discountAvg = discountAvg;
    }

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
    }

    public String getMemberPrice() {
        return memberPrice;
    }

    public void setMemberPrice(String memberPrice) {
        this.memberPrice = memberPrice;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getSellerId() {
        return sellerId;
    }

    public void setSellerId(String sellerId) {
        this.sellerId = sellerId;
    }

    public String getGoodsSkuId() {
        return goodsSkuId;
    }

    public void setGoodsSkuId(String goodsSkuId) {
        this.goodsSkuId = goodsSkuId;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getRegisterCount() {
        return registerCount;
    }

    public void setRegisterCount(String registerCount) {
        this.registerCount = registerCount;
    }

    public String getGoodsCount() {
        return goodsCount;
    }

    public void setGoodsCount(String goodsCount) {
        this.goodsCount = goodsCount;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getBargainPrice() {
        return bargainPrice;
    }

    public void setBargainPrice(String bargainPrice) {
        this.bargainPrice = bargainPrice;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }

    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }

    public String getPrimaryName() {
        return primaryName;
    }

    public void setPrimaryName(String primaryName) {
        this.primaryName = primaryName;
    }

    public String getSecondaryName() {
        return secondaryName;
    }

    public void setSecondaryName(String secondaryName) {
        this.secondaryName = secondaryName;
    }

    public String getPrice() {
        return StringUtils.getFormattedMoney(price);
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getBrandId() {
        return brandId;
    }

    public void setBrandId(String brandId) {
        this.brandId = brandId;
    }

    public String getThreeClassify() {
        return threeClassify;
    }

    public void setThreeClassify(String threeClassify) {
        this.threeClassify = threeClassify;
    }

    public String getThreeName() {
        return threeName;
    }

    public void setThreeName(String threeName) {
        this.threeName = threeName;
    }

    public String getGoodsUnit() {
        return goodsUnit;
    }

    public void setGoodsUnit(String goodsUnit) {
        this.goodsUnit = goodsUnit;
    }

    public String getShopId() {
        return shopId;
    }

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public String getSecondaryClassify() {
        return secondaryClassify;
    }

    public void setSecondaryClassify(String secondaryClassify) {
        this.secondaryClassify = secondaryClassify;
    }

    public String getPrimaryClassify() {
        return primaryClassify;
    }

    public void setPrimaryClassify(String primaryClassify) {
        this.primaryClassify = primaryClassify;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<GoodsSpecBean> getGoodsSpec() {
        return goodsSpec;
    }

    public void setGoodsSpec(List<GoodsSpecBean> goodsSpec) {
        this.goodsSpec = goodsSpec;
    }

    @Override
    public int compareTo(@NonNull Object o) {
        GoodsEntity t = (GoodsEntity) o;
        if (Long.parseLong(this.updateTime) > Long.parseLong(t.updateTime)) {
            return -1;
        } else {
            if (Long.parseLong(this.updateTime) < Long.parseLong(t.updateTime))
                return 1;
            else
                return 0;
        }
    }

    public static class GoodsSpecBean  implements Serializable{
        /**
         * name : 重量
         * value : [{name:"850克", checked:false},"900克"]
         */

        private String name;
        private String value;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

    }

    @Override
    public GoodsEntity clone() {

        try {
            return (GoodsEntity) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
}
